<!DOCTYPE HTML><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><? echo $title ?></title>
<? require("lib.php"); ?>
<style type="text/css">
.w_box { width: 132px; }
div.w_box { width: 144px; float: left; }
</style>
</head>
<body>
<div class="content-box"><!-- Start Content Box -->
    <div class="content-box-header">
    <h3><? echo $title ?></h3><div class="clear"></div>
    </div> <!-- End .content-box-header -->
    <div class="content-box-content">
<?
  switch ($do){
    case "add":
    	add();
    	break;
	case "update":
		update($info);
		break;
	case "delete":
		delete($id);
		break;
    default:
		show_info($info);
  }
 ?>
<? function show_box($row, $iseditmode, $isadd){
global $id, $cate, $zone, $gee, $h, $zonetype, $title, $lang;
	echo $h->hidden('zonetype',$zonetype);
?>
<table width="99%" cellspacing="0" cellpadding="3" class="mbox">
  <tr class="th"><td class="thtitle" width="25%" align="right"><? echo $title ?></td><td><? echo $h->hidden('id', $row["id"]); ?></td></tr>
  <tr><td class="l">物流方式</td><td><? echo $h->select('shipment_method_id', $row["shipment_method_id"],$cate->get_rows(128,'is_enabled',1,'seq_no'), 'id', 'name_'.$lang, 'g') ?></td></tr>
  <tr><td class="l">区域</td><td><? echo $h->select($zonetype.'_id', $row[$zonetype."_id"], $zone->get_rows(256,'is_enabled',1,'seq_no'), 'id', 'name_'.$lang, 'g') ?></td></tr>
  <tr><td class="l">重量</td><td><? echo $h->text('weight', $row["weight"], 'g') ?> <span class="red"> * 重量单位为g(克)</span></td></tr>
  <tr><td class="l">价格</td><td><? echo $h->text('cost', $row["cost"], 'g') ?> <span class="red"> * 元, 默认货币</span></td></tr>
  <tr><td class="l">&nbsp;</td><td><br><? echo $h->submit('save', '&nbsp; 提交保存 &nbsp;', $iseditmode==1?'':'hide') ?>&nbsp; <a onClick="history.go(-1)">[ 返回 ]</a><br><br></td></tr>
</table>
<? } ?>
<? function show_boxes($result){ 
	global $zone, $zoneid, $zonetype, $cate, $gee, $cateid, $url, $baseurl, $lang;
	$zonename=$zone->get_name($zoneid,$lang);
	$str= '<h2 class="boxh2">'.$zonename.'</h2><table width="99%" cellspacing="0" cellpadding="3" class="mlist" id="picbox"><tr class="th"><td><strong>物流方式</strong></td><td class="w_box"><strong>'.ROOT_SHIP_WEIGHT.'</strong></td><td  class="w_box"><strong>'.ROOT_SHIP_COST.'</strong></td><td  class="w_box"><strong>'.ROOT_SHIP_WEIGHT_MARGIN.'</strong></td><td  class="w_box"><strong>'.ROOT_SHIP_COST_MARGIN.'</strong></td><td class="w_box"><strong>&nbsp;</strong></td></tr>';
	foreach($result as $rows){
		$shipment_method_id=$rows['id'];
		$str.='<tr><td><strong>'.($cate->get_name($shipment_method_id,$lang)).'</strong></td><td colspan="5"><form method="post">'; 
		$where=array();
		$where[]=array('name'=>$zonetype.'_id', 'val'=>$zoneid);
		$where[]=array('name'=>'shipment_method_id', 'val'=>$shipment_method_id);
		$tem=$gee->get_rows_advanced(1,$where);
		if(!count($tem)){
			$tem=array(
				'weight'=>'','cost'=>'','weight_margin'=>'','cost_margin'=>''
			);
		}
		else $tem=$tem[0];

		$str.='<div class="w_box"><input class="gmini" name="weight" value="'.$tem['weight'].'" /> g</div>
		<div class="w_box"><input class="gmini" name="cost" value="'.$tem['cost'].'" /></div>
		<div class="w_box"><input class="gmini" name="weight_margin" value="'.$tem['weight_margin'].'" /> g</div>
		<div class="w_box"><input class="gmini" name="cost_margin" value="'.$tem['cost_margin'].'" />
		<input type="hidden" name="action" value="update" />
		<input type="hidden" name="'.$zonetype.'_id'.'" value="'.$zoneid.'" />
		<input type="hidden" name="zonetype" value="'.$zonetype.'" />
		<input type="hidden" name="shipment_method_id" value="'.$shipment_method_id.'" /></div>
		<div class="w_box"><input class="button" type="submit" value="'.ROOT_SAVE.'" /></div><div class="clear" /></div></form></td></tr>';
	}
	$str.='</table>';
	echo $str;
	//echo echo_page($page_num, $total_pages, $page.'-'.$kind.'-p');
 } ?>
<br class="clear" />
	</div> <!-- End .content-box-content -->
         <br class="clear" />
</div><!-- End .content-box -->
</body>
</html>